#ifndef MYPACKET_H
#define MYPACKET_H

#include <pcap.h>
#include <QThread>

class MyPacket: public QThread
{
    Q_OBJECT

public:
    MyPacket(QString context,QObject *parent = nullptr);
    void run() override;
    void stop();
    static void etProtocolCallBack(u_char *user,const struct pcap_pkthdr *header,const u_char *packet);

private:
    QString context;
    pcap_t *pcapUtil;
    volatile bool isRunning; //多线程下正常运行

signals:
    void captured(const QString &time,const QString &from ,const QString &to,
                  const QString &length,const QString &protocol ,const QString &info);

};



#endif // MYPACKET_H
